package com.wnx.job.modules.pms.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.wnx.job.common.api.PageResult;
import com.wnx.job.common.api.QueryPageBean;
import com.wnx.job.modules.pms.mapper.PmsPassMapper;
import com.wnx.job.modules.pms.model.PmsPass;
import com.wnx.job.modules.pms.service.PmsPassService;
import com.wnx.job.modules.rms.dto.PassParam;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author wangnaixing
 * @since 2021-12-17
 */
@Service
public class PmsPassServiceImpl extends ServiceImpl<PmsPassMapper, PmsPass> implements PmsPassService {
    @Resource
    private PmsPassMapper passMapper;


    /**
     * 根据企业ID和学生ID查询简历通过记录
     * @param companyId
     * @param studentId
     * @return
     */
    @Override
    public PmsPass findPassByCompanyIdAndStudentId(Long companyId, Long studentId) {
        return passMapper.selectOne(new QueryWrapper<PmsPass>().eq("company_id",companyId).eq("student_id",studentId));
    }

    /**
     * 查询简历通过人员名单
     * @param queryPageBean
     * @return
     */
    @Override
    public PageResult<PassParam> findPassPeople(QueryPageBean queryPageBean) {
        PageHelper.startPage(queryPageBean.getCurrentPage(),queryPageBean.getPageSize());
        Page<PassParam> passList =  passMapper.findByCondition(queryPageBean.getQueryParams());
        return PageResult.restPage(passList);
    }
}
